//处理字符串中的表情/img/@
export function handleMessage(content){
    if (content.emote) {
        let stringArr = Object.values(content.emote)
        stringArr.forEach(el => {
           let html = `<img src='${el.url}' alt="资源加载出错啦" style="width:20px;height:20px;padding:0 3px"/>`
           content.message = content.message.replaceAll(el.text, html)
        })
    } 
    if (content.pictures){
        content.pictures.forEach(el => {
            let html = `<img src='${el.img_src}' alt="资源加载出错啦" style="border-radius:4px;width:135px;height:68px"/>`
            content.message = content.message.concat(html)
        })
    }
    if (content.at_name_to_mid) {
        let keyArr = Object.keys(content.at_name_to_mid)
        let valArr = Object.values(content.at_name_to_mid)
        keyArr.forEach((el,index) => {
            let html = `<a href="#" style="color:#008AC5" data-id='${valArr[index]}'>@${el}</a>`
            content.message = content.message.replaceAll('@'+el,html)
        })
    }
    if (content.jump_url) {
        let keyArr = Object.keys(content.jump_url)
        keyArr.forEach(el => {
            let html = `<a href="#" style="color:#008AC5">${el}</a>`
            content.message = content.message.replaceAll(el,html)
        })
    }
    return content.message
}



